using UnityEngine;

public class InputHandler : MonoBehaviour {
	
	public bool editorMode = false;
	
	public bool keyboardEnabled = true;
	
	public bool tangibleEnabled = true;
	public float tangibleScanTimespan = 5f;
	public float tangibleScanDelay = 1f;
	public float tangibleAngleSensibility = 3f;
	public float tangibleMoveSensibility = 0.05f;
	public float tangibleStationaryDelay = 1f;
	
	public bool tangibleDebugMode = false;

	
	void Awake () {
		if(keyboardEnabled){
			gameObject.AddComponent<KeyboardInput>();	
		}
		
		if(tangibleEnabled){
			gameObject.AddComponent<TangibleInput>();
			TangibleInput ti = gameObject.GetComponent<TangibleInput>();
			ti.scanDelay = tangibleScanDelay;
			ti.scanTimespan = tangibleScanTimespan;
			ti.debugMode = tangibleDebugMode;
			ti.angleSensibility = tangibleAngleSensibility;
			ti.moveSensibility = tangibleMoveSensibility;
			ti.stationaryDelay = tangibleStationaryDelay;
		}
		
		if(editorMode){
			LevelConstants.editorMode = true;
		}
	}
	
	public void disable(){
		if(keyboardEnabled)
			gameObject.GetComponent<KeyboardInput>().enabled = false;
		if(tangibleEnabled)
			gameObject.GetComponent<TangibleInput>().menuMode = true;
	}
	
	public void enable(){
		if(keyboardEnabled)
			gameObject.GetComponent<KeyboardInput>().enabled = true;
		if(tangibleEnabled)
			gameObject.GetComponent<TangibleInput>().menuMode = false;
	}
	
	
	
}
